package titt.service.threading;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class SingleTITTThreader implements TITTThreader {

	private ExecutorService e = Executors.newSingleThreadExecutor();
	
	@Override
	public synchronized void clear() {
		e.shutdownNow();
	}

	@Override
	public synchronized void execute(Runnable r) {
		if(e.isShutdown())
			e = Executors.newSingleThreadExecutor();
		e.execute(r);
	}

}
